package csvReader;

//Import the needed Objects
import java.io.*;
import java.util.ArrayList;
import java.util.StringTokenizer;


public class CsvReader {
	public static void main(String[] arg) throws Exception {

		ArrayList<Object> infoList = new ArrayList<Object>();
	
		File file = new File("C:\\Users\\52410963\\Desktop\\F.5 namelist SORTED.csv");
		 
		BufferedReader bufRdr  = new BufferedReader(new FileReader(file));
		String line = null;
	
		 
		//read each line of text file
		while((line = bufRdr.readLine()) != null)
		{
			
			ArrayList<String> info = new ArrayList<String>();
			StringTokenizer st = new StringTokenizer(line,",");
			while (st.hasMoreTokens())
			{
				//get next token and store it in the array
				info.add(st.nextToken());
		
			}
			infoList.add(info);
		}
		 
		//close the file
		bufRdr.close();

		int row= infoList.size();
		int col;
		for(int i = 0; i < row; i++)
		{
			col=((ArrayList<Object>) infoList.get(i)).size();
			System.out.print("=\n");
		  for(int j = 0; j < col; j++)
		  {
		    System.out.print(((ArrayList<Object>) infoList.get(i)).get(j)+" ");
		  }
		  System.out.print("-\n");
		}

    } //main()
}
